const express = require('express');
const db = require('../db')
const router = express.Router();

/* GET home page. */
router.get('/', function (req, res, next) {
  let limit = req.query.limit - 0;
  let page = req.query.page - 0;

  res.render('index', {
    title: 'Express'
  });
  // {name:/a/} {name:/^a/}
  // db.User.find().sort({age:-1}).limit(limit).skip(page).exec((err, data) => {
  //   res.json(data)
  // res.render('index', {
  //   title: 'Express'
  // });
  // })
  // db.User.find({$or: [{name: 'user'}, {name: 'admin'}]}).exec((err, data) => {
  //   res.render('index', {
  //     title: 'Express'
  //   });
  // })
});

module.exports = router;
